package com.yanqu.road.server.cmd.kuang.cross;

import com.yanqu.road.entity.kuang.group.KuangMatchGroup;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.kuang.Kuang;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.kuang.KuangModule;
import com.yanqu.road.server.manger.kuang.KuangMgr;
import com.yanqu.road.server.pb.KuangPb;
import com.yanqu.road.server.protocol.Protocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = Protocol.S_KUANG_NOTIFY_MATCH_GROUP, desc = "跨服同步分组信息")
public class KuangNotifyMatchGroupCmd implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage yanQuMessage) throws Exception {
        Kuang.CrossNotifyMatchGroupToGameMsg reqMsg = Kuang.CrossNotifyMatchGroupToGameMsg.parseFrom(yanQuMessage.getBytes());
        KuangMatchGroup matchGroup = KuangPb.parseKuangMatchGroup(reqMsg.getGroup());
        // 同步分组信息
        KuangMgr.syncMatchGroup(matchGroup);
    }
}
